<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Whisper: stegit_math.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Whisper
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">stegit_math.h</div>  </div>
</div>
<div class="contents">
<a href="stegit__math_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef __STEGIT_MATH_H__</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define __STEGIT_MATH_H__ 1</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="comment">// include complex before fftw3.h: force fftw_complex to be compatible to std::complex</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;complex&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;valarray&gt;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;fftw3.h&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00010"></a>00010 
<a name="l00017"></a><a class="code" href="classCStegitMath.html">00017</a> <span class="keyword">class </span><a class="code" href="classCStegitMath.html" title="mathematical functionality for StegIT-2">CStegitMath</a>
<a name="l00018"></a>00018 {
<a name="l00019"></a>00019 <span class="keyword">public</span>:
<a name="l00020"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542">00020</a>         <span class="keyword">enum</span> <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542">EInterpolationType</a>
<a name="l00021"></a>00021         {
<a name="l00022"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a6055f26228bcd1ce934cbc75633aa8e3">00022</a>                 <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a6055f26228bcd1ce934cbc75633aa8e3">INTERP_TYPE_LINEAR</a> = 0,
<a name="l00023"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a4b9b08772c76f90d7e2c5119066afe04">00023</a>                 <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a4b9b08772c76f90d7e2c5119066afe04">INTERP_TYPE_POLYNOMIAL</a>,
<a name="l00024"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a565caea08923a948c8bed78a091be57a">00024</a>                 <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a565caea08923a948c8bed78a091be57a">INTERP_TYPE_CSPLINE</a>,
<a name="l00025"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a69089d55114afd321c393898c6f2fd5e">00025</a>                 <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a69089d55114afd321c393898c6f2fd5e">INTERP_TYPE_CSPLINE_PERIODIC</a>,
<a name="l00026"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542ac9433bd99529267f529a2bf46eb49ad7">00026</a>                 <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542ac9433bd99529267f529a2bf46eb49ad7">INTERP_TYPE_AKIMA</a>,
<a name="l00027"></a><a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a7bd0d148cd267c992fb7ca26e619e072">00027</a>                 <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542a7bd0d148cd267c992fb7ca26e619e072">INTERP_TYPE_AKIMA_PERIODIC</a>,
<a name="l00028"></a>00028         };
<a name="l00029"></a>00029         <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classCStegitMath.html#a27b4ccfa0f0ffd5a21b44208a66134f3">pow</a>(<span class="keywordtype">double</span> pBase, <span class="keywordtype">int</span> pPower);
<a name="l00030"></a>00030         <span class="keyword">static</span> std::complex&lt;double&gt; <a class="code" href="classCStegitMath.html#a27b4ccfa0f0ffd5a21b44208a66134f3">pow</a>(<span class="keywordtype">double</span> pBase, std::complex&lt;double&gt; pPower);
<a name="l00031"></a>00031         <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="classCStegitMath.html#a15ffac1a6a90f1a4e2060c06290265d1">log</a>(<span class="keywordtype">double</span> pValue);
<a name="l00032"></a>00032 
<a name="l00033"></a>00033         <span class="comment">// convert samples between different types, important for the embedding</span>
<a name="l00034"></a>00034         <span class="comment">// engines</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(<span class="keywordtype">double</span>* pInput, std::complex&lt;double&gt;* pOutput,
<a name="l00037"></a>00037                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00038"></a>00038         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(std::complex&lt;double&gt;* pInput, <span class="keywordtype">double</span>* pOutput,
<a name="l00039"></a>00039                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00040"></a>00040         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(std::complex&lt;double&gt;* pInput, fftw_complex* pOutput,
<a name="l00041"></a>00041                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00042"></a>00042         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(<span class="keywordtype">double</span>* pInput, fftw_complex* pOutput,
<a name="l00043"></a>00043                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00044"></a>00044         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(fftw_complex* pInput, std::complex&lt;double&gt;* pOutput,
<a name="l00045"></a>00045                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00046"></a>00046         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(fftw_complex* pInput, <span class="keywordtype">double</span>* pOutput,
<a name="l00047"></a>00047                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00048"></a>00048         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a618fa77316720e8749f3cf3ef91f039c">convert</a>(std::valarray&lt;double&gt;&amp; pInput, fftw_complex* pOutput,
<a name="l00049"></a>00049                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pLength);
<a name="l00050"></a>00050 
<a name="l00066"></a>00066         <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classCStegitMath.html#af3dd70d57daf78e8e293a6b07e8d67a2">interpolate</a>(<span class="keywordtype">double</span>* pOut,
<a name="l00067"></a>00067                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pOutLen,
<a name="l00068"></a>00068                         <span class="keywordtype">double</span>* pIn,
<a name="l00069"></a>00069                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pInLen,
<a name="l00070"></a>00070                         <span class="keywordtype">double</span>* pInTmp,
<a name="l00071"></a>00071                         <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542">EInterpolationType</a> pType,
<a name="l00072"></a>00072                         <span class="keywordtype">bool</span> pExtrapolation);
<a name="l00073"></a>00073 
<a name="l00080"></a>00080         <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classCStegitMath.html#af3dd70d57daf78e8e293a6b07e8d67a2">interpolate</a>(<span class="keywordtype">double</span>* pOut,
<a name="l00081"></a>00081                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pOutLen,
<a name="l00082"></a>00082                         <span class="keywordtype">double</span>* pIn,
<a name="l00083"></a>00083                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pInLen,
<a name="l00084"></a>00084                         <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542">EInterpolationType</a> pType,
<a name="l00085"></a>00085                         <span class="keywordtype">bool</span> pExtrapolation);
<a name="l00086"></a>00086 
<a name="l00105"></a>00105         <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classCStegitMath.html#af3dd70d57daf78e8e293a6b07e8d67a2">interpolate</a>(<span class="keywordtype">double</span>* pOut,
<a name="l00106"></a>00106                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pOutLen,
<a name="l00107"></a>00107                         <span class="keywordtype">double</span> pOutLenTime,
<a name="l00108"></a>00108                         <span class="keywordtype">double</span> pOutOffsetTime,
<a name="l00109"></a>00109                         <span class="keywordtype">double</span>* pIn,
<a name="l00110"></a>00110                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pInLen,
<a name="l00111"></a>00111                         <span class="keywordtype">double</span> pInLenTime,
<a name="l00112"></a>00112                         <a class="code" href="classCStegitMath.html#a0be3e3b409bf9210f05bf5d481fa9542">EInterpolationType</a> pType);
<a name="l00113"></a>00113 
<a name="l00117"></a>00117         <span class="keyword">static</span> uint16_t <a class="code" href="classCStegitMath.html#acaec45aadb8ad72a794a5cb88cb65ba7">inCksum</a>(<span class="keywordtype">void</span> *pAddr, <span class="keywordtype">int</span> pLen);
<a name="l00118"></a>00118 
<a name="l00119"></a>00119         <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="classCStegitMath.html#a6cac42e396b9ac1885f25834fb018c48">CRC8_BlockChecksum</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">int</span> length);
<a name="l00120"></a>00120 <span class="keyword">private</span>:
<a name="l00121"></a>00121         <a class="code" href="classCStegitMath.html#a23d68c7d003b762506a2c0978f4dff98">CStegitMath</a>();
<a name="l00122"></a>00122         <a class="code" href="classCStegitMath.html#a23d68c7d003b762506a2c0978f4dff98">CStegitMath</a>(<span class="keyword">const</span> <a class="code" href="classCStegitMath.html" title="mathematical functionality for StegIT-2">CStegitMath</a>&amp; );
<a name="l00123"></a>00123         <a class="code" href="classCStegitMath.html" title="mathematical functionality for StegIT-2">CStegitMath</a>&amp; <a class="code" href="classCStegitMath.html#afef294312b5d195b67a8cfd77ab8f42d">operator=</a>(<span class="keyword">const</span> <a class="code" href="classCStegitMath.html" title="mathematical functionality for StegIT-2">CStegitMath</a>&amp; );
<a name="l00124"></a>00124 
<a name="l00128"></a><a class="code" href="classCStegitMath.html#a86b20966f95cb5876c69322bbdeb4f7a">00128</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classCStegitMath.html#a86b20966f95cb5876c69322bbdeb4f7a">sLogApproxRounds</a>;
<a name="l00129"></a>00129 
<a name="l00130"></a><a class="code" href="classCStegitMath.html#a5123da0c1e40a20c5c8f3ae58577a211">00130</a>         <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="classCStegitMath.html#a5123da0c1e40a20c5c8f3ae58577a211">sCRCTable</a>[256];
<a name="l00131"></a>00131 
<a name="l00132"></a>00132         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a593e6b8eca03982089d53d8ce3bee75e">CRC8_InitChecksum</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> &amp;crcvalue);
<a name="l00133"></a>00133         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#abdb183fcfab6424ba758375580760f7b">CRC8_Update</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> &amp;crcvalue, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> data);
<a name="l00134"></a>00134         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#ab90e869afefa8ce36f79320d04fd2523">CRC8_UpdateChecksum</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> &amp;crcvalue, <span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">int</span> length);
<a name="l00135"></a>00135         <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCStegitMath.html#a342173d6ce1ca336f2fa7dbe2d6ec4af">CRC8_FinishChecksum</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> &amp;crcvalue);
<a name="l00136"></a>00136 };
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 <span class="preprocessor">#endif // __STEGIT_MATH_H__</span>
<a name="l00139"></a>00139 <span class="preprocessor"></span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 25 2012 22:00:39 for Whisper by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
